package com.zige.zige.view.panoplayer;

import android.view.Surface;

/**
 * Created by admin on 16/1/5.
 */
public abstract class AbstractVideoPlayer {
    protected boolean autoLoop = false;
    protected boolean autoPlayWhenBuffered = true;
    protected double preloadTime = 5.0f;
    protected double progressNotificationPeriod = 0.1f;
    protected VideoStateListener videoStateListener = null;

    abstract public void prepare(String url);
    abstract public void play();
    abstract public void pause();
    abstract public void beforeSeek();
    abstract public void seekToPercentage(double percentage);
    abstract public void afterSeek();
    abstract public boolean isPlaying();
    abstract public double getDuration();
    abstract public int getCurPosition();
    abstract public void setSurface(Surface surface);
    abstract public void cleanUp();

    public boolean isAutoLoop() {
        return autoLoop;
    }

    public boolean isAutoPlayWhenBuffered() {
        return autoPlayWhenBuffered;
    }

    public double getPreloadTime() {
        return preloadTime;
    }

    public double getProgressNotificationPeriod() {
        return progressNotificationPeriod;
    }

    public void setAutoLoop(boolean autoLoop) {
        this.autoLoop = autoLoop;
    }

    public void setAutoPlayWhenBuffered(boolean autoPlayWhenBuffered) {
        this.autoPlayWhenBuffered = autoPlayWhenBuffered;
    }

    public void setPreloadTime(double preloadTime) {
        this.preloadTime = preloadTime;
    }

    public void setProgressNotificationPeriod(double progressNotificationPeriod) {
        this.progressNotificationPeriod = progressNotificationPeriod;
    }

    public void setVideoStateListener(VideoStateListener videoStateListener) {
        this.videoStateListener = videoStateListener;
    }

}
